package com.yuan.springcloud.order;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author YouYuan
 * @version 1.0
 * @date 2020/3/25 3:53
 */
@SpringBootApplication
@EnableFeignClients //激活Feign
@EnableCircuitBreaker //激活Hystrix
@EnableHystrixDashboard //激活Hystrix监控仪表盘
public class OrderApplication {

    // 声明使用Ribbon提供的负载均衡调用服务
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }
}
